package cc.vicp.djx314.starfood.service.account.impls;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cc.vicp.djx314.starfood.dao.account.ManagerMapper;
import cc.vicp.djx314.starfood.domain.account.Manager;
import cc.vicp.djx314.starfood.service.account.ManagerService;
import cc.vicp.djx314.starfood.service.exception.UserNotFoundException;

@Service
public class ManagerServiceImpl implements ManagerService {
	@Autowired
	ManagerMapper managerMapper;

	@Override
	@Transactional(readOnly = true)
	public Manager getManagerInfoForSession(String accountName) throws UserNotFoundException {
		Manager manager = managerMapper.getManagerInfoForSession(accountName);
		if (manager == null) {
			throw new UserNotFoundException("不存在此经理账号");
		}
		return manager;
	}
}